package exp3;

import exp2.SLlist;

public class MyLinkedQueue<T> {
    private SLlist queue;
    private int size;
    public MyLinkedQueue() {
        queue = new SLlist();
        size = 0;
    }
    public void offer(int t) {
        queue.pushFront(t);
        size++;
    }
    public void poll() {
        queue.deletelast();
        size--;
    }
    public int peek() {
        return queue.last();
    }
    @Override
    public String toString() {
        return queue.toString() + " size: " + size;
    }

    public static void main(String[] args) {
        MyLinkedQueue<Integer> queue = new MyLinkedQueue<>();
        for (int i = 0; i < 5; i++) {
            queue.offer(i);
            System.out.println(queue);
        }
        for (int i = 0; i < 5; i++) {
            queue.poll();
            System.out.println(queue);
        }
    }
}
